import { defineStore } from "pinia"

const mainStore = defineStore("main", {
    state(){
        return {
            setPageVipCardList:[],//获取会员卡数据
            SearchVipCardListByIdList:[],//根据id查询会员卡数据
            userVipCardPageList:[],//用户会员卡信息
            UserCardInfo:[],//根据会员卡id查询用户信息
        }
    },
    persist: {
        enabled: true, // 开启持久化保存
    },
    actions: {
        setPageVipCard(setPageVipCardList:Array<any>){
            this.setPageVipCardList = setPageVipCardList
            //  console.log( this.setPageVipCardList);
        },
        setSearchVipCardListById(SearchVipCardListByIdList:Array<any>){
            this.SearchVipCardListByIdList = SearchVipCardListByIdList
             console.log( this.SearchVipCardListByIdList);
        },
        setUserVipCardPageList(userVipCardPageList:Array<any>){
            this.userVipCardPageList = userVipCardPageList
             console.log( this.userVipCardPageList);
        },
        setUserCardInfo(UserCardInfo:Array<any>){
            this.UserCardInfo = UserCardInfo
            console.log("UserCardInfo",this.UserCardInfo);
            
        }
    },
    getters: {
        getPageVipCard():Array<any>{
            return [...this.setPageVipCardList]
        },
        getSearchVipCardListById():Array<any>{
            // console.log(this.SearchVipCardListByIdList);
            return this.SearchVipCardListByIdList
        },
        getUserVipCardPageList():Array<any>{
            // console.log(this.SearchVipCardListByIdList);
            return this.userVipCardPageList
        },
        getUserCardInfo():Array<any>{
            this.UserCardInfo.createTime = this.UserCardInfo.createTime.slice(0, 10)
            console.log("拿去数据",this.UserCardInfo.createTime);
            return this.UserCardInfo
        },

    }
})


export default mainStore;